Page({
  onLoad({ id }) {
    this.getHouseDetail(id)
  },

  async getHouseDetail(id) {
    if (!id) {
      wx.utils.toast('参数不完整')
      return wx.navigateBack()
    }
    const { code, data: houseDetail } = await wx.http.get(`/room/${id}`)
    if (code !== 10000) return wx.utils.toast('获取房屋详情失败')
    this.setData({
      ...houseDetail,
    })
  },

  editHouse(ev) {
    wx.navigateTo({
      url: `/house_pkg/pages/form/index?id=${ev.mark.id}`,
    })
  },
})
